﻿/*
 * TextFormatHelper
 * 
 * Plase use this class to format debug/trace output text
 * 
 * Principle:
 *      "method" is strongly recommanded
 *      Always use "WriteLine" which append a '\n' at the end of input
 *      
 * Author: snowdreamist
 * Date: 2011/12/14
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BitTorrentSharp.Diagnostics
{
    public static class TextFormatHelper
    {
        /// <summary>
        /// Format text
        /// Looks like:
        ///     DHT@23:15:01 =
        ///         This is sample output
        /// </summary>
        /// <param name="text">text</param>
        /// <param name="component">your component</param>
        /// <returns></returns>
        public static string Format(string text, string component)
        {
            return string.Format("{0}@{1} =\n\t{2}", component, DateTime.Now.ToString("HH:mm:ss"), text);
        }
        /// <summary>
        /// Format text
        /// Looks like:
        ///     DHT@23:15:01 on AddNode =
        ///         This is a sample output
        /// </summary>
        /// <param name="text">text</param>
        /// <param name="component">your component</param>
        /// <returns></returns>
        public static string Format(string text, string component, string method)
        {
            return string.Format("{0}@{1} on {2} =\n\t{3}", component, DateTime.Now.ToString("HH:mm:ss"), method, text);
        }
    }
}
